package com.platform.enums.converters;

import com.platform.enums.FunctionStatus;

import javax.persistence.AttributeConverter;

/**
 * Description: 菜单状态枚举转换-JPA
 *
 * @author libin Created on 2019/7/24
 **/
public class FunctionStatusConverter implements AttributeConverter<FunctionStatus, Integer> {
    @Override
    public Integer convertToDatabaseColumn(FunctionStatus attribute) {
        return attribute.getCode();
    }

    @Override
    public FunctionStatus convertToEntityAttribute(Integer dbData) {
        return FunctionStatus.getByValue(dbData);
    }
}
